﻿<Window x:Class="LogicalTreeview.Window1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="Window1" Height="300" Width="300" 
    xmlns:local="clr-namespace:LogicalTreeview"
       >
    <Grid x:Name="LayoutRoot" >
        <Grid.Resources>
      <Style x:Key="HeaderStyle" TargetType="TextBlock"> 
        <Setter Property="HorizontalAlignment" Value="Center" /> 
        <Setter Property="FontWeight" Value="Bold" /> 
        <Setter Property="Foreground" Value="Blue" /> 
        
      </Style>
        <HierarchicalDataTemplate DataType= "{x:Type local:Parent}"
                                ItemsSource = "{Binding Children}">
                <TextBlock Text="{Binding Path=Name}"/>
            </HierarchicalDataTemplate>
            
            <DataTemplate DataType="{x:Type local:Child}"> 
                <TextBlock Foreground="Black" Text="{Binding Name}" />                 
            </DataTemplate>
        </Grid.Resources>
        <Grid.ColumnDefinitions> 
            <ColumnDefinition Width="*" MaxWidth="400"/>
            <ColumnDefinition Width="*" MaxWidth="400"/>
        </Grid.ColumnDefinitions>

    <Grid.RowDefinitions>
      <RowDefinition Height="20" /> 
      <RowDefinition Height="Auto" />
      <RowDefinition Height="20" />
      <RowDefinition Height="*" />
    </Grid.RowDefinitions>
    <TextBlock Text="XAML" Style="{StaticResource HeaderStyle}"/> 
    <TextBlock Text="UI" Style="{StaticResource HeaderStyle}" Grid.Column="1"/>
    <TextBlock Text="Logical Tree" Grid.Row="2" Style="{StaticResource HeaderStyle}"/>
    <TextBlock Text="Visual Tree" Grid.Row="2" Grid.Column="1" Style="{StaticResource HeaderStyle}"/>

    <TreeView x:Name="treeviewLogical"  ItemsSource="{Binding}" Grid.Column="0" Grid.Row="3" />
     <TreeView x:Name="treeviewVisual"  ItemsSource="{Binding}" Grid.Column="1" Grid.Row="3"/>
      <TextBox x:Name="XAML" Grid.Column="0"  Grid.Row="1" TextWrapping="Wrap" AcceptsReturn="True" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" MinHeight="100"/> 
    <DockPanel Grid.Column="1" x:Name="container" Width="140" Grid.Row="1"> 
            <StackPanel Margin="4" Width="100"> 
                <Button Content="button content" />
                <TextBox>text</TextBox>
             </StackPanel>            
        </DockPanel>
    </Grid>
</Window>
